package day04;

/**
 for循环的使用
 * @author Smartloe
 * @create 2021-04-03 16:14
 */
public class ForTest {
    public static void main(String[] args) {
        for (int i = 0; i < 50; i++) {
            System.out.println("Hello World!");
        }
        //例题：遍历100以内的偶数,输出所有偶数的和
        int sum = 0;
        int count = 0;
        for (int i = 1; i <= 60000; i++) {
            if (i%2==0){
                System.out.println(i);
                sum += i;
                count++;
            }
        }
        System.out.println("总和为："+sum+"\n偶数个数为："+count);
    }
}
